package com.project.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.daos.AdminStallMapper;
import com.project.entity.Stall;
import com.project.entity.Users;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminStallService {

    @Autowired
    private AdminStallMapper adminStallMapper;

    public PageInfo<Stall> selAllStall(Integer currentPage,Integer pageSize){
        PageHelper.startPage(currentPage,pageSize);
        List<Stall> stalls = adminStallMapper.selAllStall();
        PageInfo<Stall> usersPageInfo = new PageInfo<>(stalls);
        return usersPageInfo;
    }

    public PageInfo<Stall> selConditionStall(String keyWord,Integer currentPage,Integer pageSize){
        PageHelper.startPage(currentPage,pageSize);
        List<Stall> stalls = adminStallMapper.selConditionStall(keyWord);
        PageInfo<Stall> usersPageInfo = new PageInfo<>(stalls);
        return usersPageInfo;
    }

    public Integer delStall(Object[] ids){
        Integer delCount = adminStallMapper.delStall(ids);
        return delCount;
    }
    public Integer recoverStall(Object[] ids){
        Integer delCount = adminStallMapper.recoverStall(ids);
        return delCount;
    }
    public Integer delOneStall(Integer id){
        Integer delCount = adminStallMapper.delOneStall(id);
        return delCount;
    }
    public Integer recoverOneStall(Integer id){
        Integer delCount = adminStallMapper.recoverOneStall(id);
        return delCount;
    }
}
